Allow setting a canonical URL via ogp_canonical_url
#134
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR builds on #133, only the final commit is new.
We introduce a new setting,
ogp_canonical_url
, which defines the canonical or permanent URL for a webpage, similarly torel="canonical"
. The motivating example is Python's documentation, where we have multiple different sites (e.g. 3.12, 3.13, 3.14), but we want search engines and other tools to usedocs.python.org/3/
as the canonical URL.I had considered solving this problem another way, by allowing the URL only for images to be changed, but I believe that this solution is conceptually better, and maps more closely to the description of
og:url
in the Open Graph Protocol specification.Please let me know your thoughts and feedback!
A